<template>
  <div id="default">
    <Header />
      <slot />
    <Footer />
  </div>  
</template>
<script lang="ts">

export default {
  transition:'bounce',
  setup() {
    const showIframe = ref(true)
    const canToTop = ref(false)
    const handlerScroll = () => {
      var myScrollTop =
        document.documentElement.scrollTop || document.body.scrollTop
      myScrollTop > 760 ? (canToTop.value = true) : (canToTop.value = false)
    }
    const toTop = () => {
      var myTop = document.documentElement.scrollTop || document.body.scrollTop
      // 实现滚动效果
      const timeTop = setInterval(() => {
        document.body.scrollTop =
          document.documentElement.scrollTop =
          myTop -=
            180
        if (myTop <= 0) clearInterval(timeTop)
      }, 10)
    }
    if(process.client) {
       var _hmt = _hmt || [];
      (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?5db1ccbe6285b75fdd4b26d0f843e840";
        var s = document.getElementsByTagName("script")[0]; 
        s.parentNode.insertBefore(hm, s);
      })();
    }
    onMounted(() => {
      window.addEventListener('scroll', handlerScroll, true)
    })
    return {
      showIframe,
      canToTop,
      toTop,
    }
  },
}
</script>

<style lang="scss" scoped>
// * {
//   // 禁止选中文字
//   moz-user-select: -moz-none;
//   -moz-user-select: none;
//   -o-user-select: none;
//   -khtml-user-select: none;
//   -webkit-user-select: none;
//   -ms-user-select: none;
//   user-select: none;
// }
</style>
